
TRIGGER PROCEDURE FOR WRITE OF PI_MSTR OLD BUFFER OLD_PI_MSTR.


{mfdeclre.i }
define new shared work-table wf_old_pi_mstr like pi_mstr.

/* fdn 2004/10/28 Modify Record processing */
HK:
do:
    if can-find(first dt_mstr where dt_table = "pi_mstr" and dt_type = "SYNC") then
        run CreateSyncFlag(input "MOD", input recid(pi_mstr), input "pi_mstr").

    if not can-find ( first dt_mstr where dt_table = "pi_mstr" and dt_type = "MOD" ) then leave HK.
    
    if not can-find ( first wf_old_pi_mstr ) then do:
        create wf_old_pi_mstr.
        if recid(wf_old_pi_mstr)= -1 then .
    end.
    
    buffer-copy old_pi_mstr to wf_old_pi_mstr no-error.

    for each dt_mstr no-lock where dt_table = "pi_mstr" and dt_type = "MOD" :
    
        case dt_field :

            when "pi_list" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_pi_mstr.pi_list, input pi_mstr.pi_list,
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_desc" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_pi_mstr.pi_desc, input pi_mstr.pi_desc,
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_cs_code" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_pi_mstr.pi_cs_code, input pi_mstr.pi_cs_code,
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_part_code" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_pi_mstr.pi_part_code, input pi_mstr.pi_part_code,
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_start" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_pi_mstr.pi_start), input string(pi_mstr.pi_start),
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_expire" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_pi_mstr.pi_expire), input string(pi_mstr.pi_expire),
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_comb_type" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_pi_mstr.pi_comb_type, input pi_mstr.pi_comb_type,
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_amt_type" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_pi_mstr.pi_amt_type, input pi_mstr.pi_amt_type,
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_break_cat" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_pi_mstr.pi_break_cat, input pi_mstr.pi_break_cat,
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_um" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_pi_mstr.pi_um, input pi_mstr.pi_um,
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_curr" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_pi_mstr.pi_curr, input pi_mstr.pi_curr,
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_qty_type" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_pi_mstr.pi_qty_type, input pi_mstr.pi_qty_type,
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_manual" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_pi_mstr.pi_manual), input string(pi_mstr.pi_manual),
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_max_qty" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_pi_mstr.pi_max_qty), input string(pi_mstr.pi_max_qty),
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_cost_set" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_pi_mstr.pi_cost_set, input pi_mstr.pi_cost_set,
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_disc_acct" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_pi_mstr.pi_disc_acct, input pi_mstr.pi_disc_acct,
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_disc_sub" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_pi_mstr.pi_disc_sub, input pi_mstr.pi_disc_sub,
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_disc_proj" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_pi_mstr.pi_disc_proj, input pi_mstr.pi_disc_proj,
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_list_id" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_pi_mstr.pi_list_id, input pi_mstr.pi_list_id,
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_confg_disc" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_pi_mstr.pi_confg_disc), input string(pi_mstr.pi_confg_disc),
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_min_net" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_pi_mstr.pi_min_net), input string(pi_mstr.pi_min_net),
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_max_ord" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_pi_mstr.pi_max_ord), input string(pi_mstr.pi_max_ord),
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_list_price" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_pi_mstr.pi_list_price), input string(pi_mstr.pi_list_price),
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_min_price" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_pi_mstr.pi_min_price), input string(pi_mstr.pi_min_price),
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_max_price" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_pi_mstr.pi_max_price), input string(pi_mstr.pi_max_price),
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_userid" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_pi_mstr.pi_userid, input pi_mstr.pi_userid,
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_mod_date" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_pi_mstr.pi_mod_date), input string(pi_mstr.pi_mod_date),
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_cs_type" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_pi_mstr.pi_cs_type, input pi_mstr.pi_cs_type,
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_part_type" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_pi_mstr.pi_part_type, input pi_mstr.pi_part_type,
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_disc_cc" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_pi_mstr.pi_disc_cc, input pi_mstr.pi_disc_cc,
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_terms" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_pi_mstr.pi_terms, input pi_mstr.pi_terms,
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_cmtindx" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_pi_mstr.pi_cmtindx), input string(pi_mstr.pi_cmtindx),
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_srch_type" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_pi_mstr.pi_srch_type), input string(pi_mstr.pi_srch_type),
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_print" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_pi_mstr.pi_print), input string(pi_mstr.pi_print),
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_accr_acct" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_pi_mstr.pi_accr_acct, input pi_mstr.pi_accr_acct,
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_accr_cc" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_pi_mstr.pi_accr_cc, input pi_mstr.pi_accr_cc,
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_accr_proj" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_pi_mstr.pi_accr_proj, input pi_mstr.pi_accr_proj,
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_accr_sub" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_pi_mstr.pi_accr_sub, input pi_mstr.pi_accr_sub,
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_disc_seq" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_pi_mstr.pi_disc_seq), input string(pi_mstr.pi_disc_seq),
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_user1" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_pi_mstr.pi_user1, input pi_mstr.pi_user1,
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_user2" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_pi_mstr.pi_user2, input pi_mstr.pi_user2,
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi__qadc01" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_pi_mstr.pi__qadc01, input pi_mstr.pi__qadc01,
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi__qadd01" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_pi_mstr.pi__qadd01), input string(pi_mstr.pi__qadd01),
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi__dte01" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_pi_mstr.pi__dte01), input string(pi_mstr.pi__dte01),
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi__dte02" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_pi_mstr.pi__dte02), input string(pi_mstr.pi__dte02),
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi__dec01" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_pi_mstr.pi__dec01), input string(pi_mstr.pi__dec01),
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi__dec02" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_pi_mstr.pi__dec02), input string(pi_mstr.pi__dec02),
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi__log01" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_pi_mstr.pi__log01), input string(pi_mstr.pi__log01),
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi__chr01" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_pi_mstr.pi__chr01, input pi_mstr.pi__chr01,
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi__chr02" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_pi_mstr.pi__chr02, input pi_mstr.pi__chr02,
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi__chr03" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_pi_mstr.pi__chr03, input pi_mstr.pi__chr03,
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi__chr04" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_pi_mstr.pi__chr04, input pi_mstr.pi__chr04,
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi__chr05" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_pi_mstr.pi__chr05, input pi_mstr.pi__chr05,
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi__chr06" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_pi_mstr.pi__chr06, input pi_mstr.pi__chr06,
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi__chr07" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_pi_mstr.pi__chr07, input pi_mstr.pi__chr07,
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi__chr08" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_pi_mstr.pi__chr08, input pi_mstr.pi__chr08,
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi__chr09" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_pi_mstr.pi__chr09, input pi_mstr.pi__chr09,
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi__chr10" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_pi_mstr.pi__chr10, input pi_mstr.pi__chr10,
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_extrec" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_pi_mstr.pi_extrec), input string(pi_mstr.pi_extrec),
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_promo1" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_pi_mstr.pi_promo1, input pi_mstr.pi_promo1,
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_promo2" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_pi_mstr.pi_promo2, input pi_mstr.pi_promo2,
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_promo3" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_pi_mstr.pi_promo3, input pi_mstr.pi_promo3,
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_promo4" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_pi_mstr.pi_promo4, input pi_mstr.pi_promo4,
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

            when "pi_pig_code" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_pi_mstr.pi_pig_code, input pi_mstr.pi_pig_code,
                    input recid(pi_mstr), input pi_mstr.pi_list, input pi_mstr.pi_part_code, input pi_mstr.pi_cs_code, input pi_mstr.pi_part_type,
                    input pi_mstr.pi_cs_type, input pi_mstr.pi_curr, input pi_mstr.pi_um, input string(pi_mstr.pi_start)).

        end.

    end.
end.

{hkdttrans.i}
